package com.whj.homework_step1_model_4.controller;

import com.whj.homework_step1_model_4.pojo.Article;
import com.whj.homework_step1_model_4.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/homework")
public class ArticleController {
    @Autowired
    private ArticleService articleService;
    //分页查询接口
    @RequestMapping(value = "/list/{currentPage}/{size}",method = {RequestMethod.GET})
    public Page<Article> getAll(
            @PathVariable Integer currentPage,
            @PathVariable Integer size
    ){
        return this.articleService.getAll(currentPage,size);
    }
}
